package com.kodcu.web;

import com.kodcu.web.book.BookMainPage;
import com.kodcu.web.home.HomePage;
import com.kodcu.web.iletisim.IletisimMainPage;
import com.kodcu.web.referanslar.ReferanslarMainPage;
import com.kodcu.web.training.TrainingPage;
import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.target.coding.IndexedParamUrlCodingStrategy;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;


public class Application extends WebApplication {

    protected SpringComponentInjector getSpringInjector() {
        return new SpringComponentInjector(this); // Spring
    }

    public void init() {
        // configuration params come here...
        getResourceSettings().addResourceFolder("src/main/java");
        getResourceSettings().addResourceFolder("src/main/resources");

        mount(new IndexedParamUrlCodingStrategy("anasayfa", HomePage.class));
        mount(new IndexedParamUrlCodingStrategy("java-egitim", TrainingPage.class));
        mount(new IndexedParamUrlCodingStrategy("kitap", BookMainPage.class));
        mount(new IndexedParamUrlCodingStrategy("referanslar", ReferanslarMainPage.class));
        mount(new IndexedParamUrlCodingStrategy("iletisim", IletisimMainPage.class));
        addComponentInstantiationListener(getSpringInjector());   // Spring
    }

    public Class<? extends Page> getHomePage() {
        return TrainingPage.class;

    }
}
